package org.webArchi.common.api.service;

import org.webArchi.common.api.domain.User;
import org.webArchi.common.exception.SriTelRuntimeException;

import javax.persistence.PersistenceException;


/**
 * @author amith jayasekara
 */


public interface UserManagmentService {

    /**
     * Create a system user
     * This will create a new user if user is not already inserted to the data base
     *
     * @param user user object
     * @throws SriTelRuntimeException if user all ready exist or create user logic related exceptions
     * @throws PersistenceException   if persistence exception happens
     * @throws Exception              for any other exception
     */
    public void createUser(User user) throws SriTelRuntimeException, PersistenceException, Exception;

    /**
     * Get user object for give userId
     *
     * @param userId user id of the user to be fetch.
     * @return user object if found else null
     */
    public User getUserByUserId(String userId);

    /**
     * update a user profile details
     *
     * @param user updated user profile information object
     * @throws SriTelRuntimeException if new user profile does not meet application requirements.
     * @throws PersistenceException   if persistence related exception happen.
     * @throws Exception              For any other exception
     */
    public void updateUser(User user) throws SriTelRuntimeException, PersistenceException, Exception;

    /**
     * deleting user account ( actually this will not remove record but change the user account to deactivate mode.
     *
     * @param userId
     * @throws SriTelRuntimeException if business logic failed.
     * @throws PersistenceException   if persistence related exception happen.
     * @throws Exception              For any other exception
     */
    public void deleteUser(String userId) throws SriTelRuntimeException, PersistenceException, Exception;


}
